<table id="datagrid_${action_id}"></table>
<div id="datagrid_tb_${action_id}" style="padding:5px;height:auto">
	${action.getDatagridTitle('name')}:
	<input class="easyui-validatebox" style="width: 200px;" name="_searcher_lky_name" >
	&nbsp;&nbsp;&nbsp;&nbsp;
	<a href="javascript:;;" onclick="javascript:$('#datagrid_tb_${action_id}').searcher('doSearch')" class="easyui-linkbutton" iconCls="icon-search">查询</a>
</div>
<script type="text/javascript">

$(function() {
	$('#datagrid_tb_${action_id}').searcher({
		doSearch:function(qp){
			if(cid_${action_id}>0){
				$.extend(qp,{'_searcher_eq_classifyId?long':cid_${action_id}});
			}
			$('#datagrid_${action_id}').datagrid('options').queryParams = qp;
			$('#datagrid_${action_id}').datagrid('reload');
		}
	});
	$('#datagrid_${action_id}').datagrid({
		iconCls:'icon-save',
		width:'auto',
		height:'auto',
		nowrap: false,
		fit:true,
		singleSelect:true,
		fitColumns:true,
		striped: true,
		sortName: 'serial',
		sortOrder: 'asc',
		url:'${request.contextPath}${namespace?default('')}/mp/product/product-datagrid.json',
		remoteSort: true,
		idField:'id',
		onBeforeLoad:function(){$('#datagrid_${action_id}').datagrid('unselectAll');},
		columns:[[
					{title:'${action.getDatagridTitle('serial')}',field:'serial',width:100,align:'center',sortable:true},
					{title:'${action.getDatagridTitle('name')}',field:'name',width:100,align:'center'},
					{title:'${action.getDatagridTitle('classify')}',field:'classify',width:100,align:'center',formatter:function(val,rec){
						return val.name;
					}},
					{title:'${action.getDatagridTitle('guidePrice')}',field:'guidePrice',width:100,align:'center'},
					{title:'${action.getDatagridTitle('price')}',field:'price',width:100,align:'center'},
					{title:'${action.getDatagridTitle('floorReferencePrice')}',field:'floorReferencePrice',width:100,align:'center'},
					{title:'${action.getDatagridTitle('marketEnable')}',field:'marketEnable',width:100,align:'center',formatter:function(val,rec){
						<#list productEnables as productEnable>
							if(${productEnable.marketEnable}==val){
								return '${action.getDatagridTitle('marketEnable.'+productEnable.name())}';
							}
						</#list>
						return rec.name;
					}},
					{title:'${action.getDatagridTitle('stock')}',field:'stock',width:100,align:'center'},
					{title:'${action.getDatagridTitle('sell')}',field:'sell',width:100,align:'center'},
					{title:'${action.getDatagridTitle('click')}',field:'click',width:100,align:'center'},
				]],
		pagination:true,
		rownumbers:true,
		toolbar:'#datagrid_tb_${action_id}',
		onDblClickRow:function(idx,data){if(typeof onDblClickRow_${action_id} != 'undefined'){onDblClickRow_${action_id}(idx,data)}},
		onClickRow:function(idx,data){if(typeof onClickRow_${action_id} != 'undefined'){onClickRow_${action_id}(idx,data)}},
		onRowContextMenu:function(e,idx,data){if(typeof onRowContextMenu_${action_id} != 'undefined'){$(this).datagrid('selectRow', idx);onRowContextMenu_${action_id}(e,idx,data)}}
	});

});

</script>
